#include <iostream>
using namespace std;

int main() {

    int L, R;
    cin >> L >> R;
    int sum = 0;
    for (int i = L; i <= R; i++) {
        if (i == 2) {
            sum++;
        }
        else {
            int tmp = i;
            while (tmp > 11) {
                if (tmp % 10 == 2) {
                    sum++;
                }
                tmp /= 10;
                if (tmp == 2) {
                    sum++;
                }
            }
        }
    }
    cout << sum;
    return 0;
}
